using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Daniel.Core.Models.Mapping
{
    public class Forums_SubscriptionMap : EntityTypeConfiguration<Forums_Subscription>
    {
        public Forums_SubscriptionMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("Forums_Subscription");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.SubscriptionGuid).HasColumnName("SubscriptionGuid");
            this.Property(t => t.CustomerId).HasColumnName("CustomerId");
            this.Property(t => t.ForumId).HasColumnName("ForumId");
            this.Property(t => t.TopicId).HasColumnName("TopicId");
            this.Property(t => t.CreatedOnUtc).HasColumnName("CreatedOnUtc");

            // Relationships
            this.HasRequired(t => t.Customer)
                .WithMany(t => t.Forums_Subscription)
                .HasForeignKey(d => d.CustomerId);

        }
    }
}
